
import { SimulationJob } from '../entities/simulationJob';
import { SimulationJobDto } from '../dtos';
import { DeepPartial } from 'typeorm';

export function entityToDto(e: SimulationJob): SimulationJobDto {
  return {
    id: e.id,
    product: e.product,
    desc: e.desc,
    businessId: e.business_id,
    status: e.status,
    agentId: e.agent_id,
    userId: e.user_id,
    appId: e.app_id,
    nodeId: e.node_id,
    debug: e.debug,
    notificationCallback: e.notification_callback,
    spec: e.spec,
    result: e.result,
    message: e.message,
    submitAt: e.submit_at,
    startedAt: e.started_at,
    finishedAt: e.finished_at,
    progress: e.progress,
    type: e.type,
    subJobIds: e.subJobIds,
    parentId: e.parentJobId
  };
}

export function dtoToEntityLike(dto: SimulationJobDto): DeepPartial<SimulationJob> {
  return {
    id: dto.id,
    product: dto.product,
    desc: dto.desc,
    business_id: dto.businessId,
    status: dto.status,
    agent_id: dto.agentId,
    user_id: dto.userId,
    app_id: dto.appId,
    node_id: dto.nodeId,
    debug: dto.debug,
    notification_callback: dto.notificationCallback,
    spec: dto.spec,
    result: dto.result,
    message: dto.message,
    submit_at: dto.submitAt,
    started_at: dto.startedAt,
    finished_at: dto.finishedAt,
    progress: dto.progress,
    type: dto.type,
    subJobIds: dto.subJobIds,
    parentJobId: dto.parentId
  };
}